<template>
	<view class="c-content">
		<view class="add-recode">
			<u-toast ref="uToast"></u-toast>
			<view class="add-type">
				<text class="type-title r-flex">助理姓名:</text>
				<u-input placeholder="请输入助理姓名" border="bottom" v-model="assistObj.assistName" maxlength="20" clearable>
				</u-input>
			</view>
			<view class="add-type">
				<text class="type-title r-flex">助理邮箱:</text>
				<u-input placeholder="请输入助理邮箱" border="bottom" v-model="assistObj.assistEmail" maxlength="20" clearable>
				</u-input>
			</view>
			<view class="add-type">
				<text class="type-title r-flex">手机号码:</text>
				<u-input placeholder="请输入" border="bottom" v-model="assistObj.mobileNo" maxlength="11" clearable>
				</u-input>
			</view>
			<view class="add-type">
				<text class="type-title r-flex">密码:</text>
				<u-input placeholder="请输入密码" border="bottom" v-model="assistObj.password" maxlength="8" :password="true"
					clearable>
				</u-input>
			</view>
			<view class="add-type">
				<text class="type-title r-flex">确认密码:</text>
				<u-input placeholder="请输入确认密码" border="bottom" v-model="assistObj.surePassword" maxlength="8"
					:password="true" clearable>
				</u-input>
			</view>
		</view>
		<u-gap height="12" bgColor="#fff"></u-gap>
		<view class="add-btn">
			<u-button @click="addAssist()" shape="circle" color="#1C5AD2">添加</u-button>
		</view>
	</view>
</template>

<script>
	import {
		mobilePattern
	} from "@/common/vit.js"
	export default {
		data() {
			return {
				assistObj: {
					assistName: "",
					assistEmail: "",
					mobileNo: "",
					password: "",
					surePassword: ""
				}
			}
		},
		methods: {
			// 保存当事人信息
			addAssist() {
				const that = this;
				if (!this.assistObj.assistName) {
					return this.$refs.uToast.show({
						message: '姓名不能为空',
						type: 'default',
					})
				}
				if (!this.assistObj.assistEmail) {
					return this.$refs.uToast.show({
						message: '邮箱不能为空',
						type: 'default',
					})
				}
				if (!mobilePattern(this.assistObj.mobileNo)) {
					return this.$refs.uToast.show({
						message: '请输入正确的手机号',
						type: 'default',
					})
				}
				if (!this.assistObj.password) {
					return this.$refs.uToast.show({
						message: '密码不能为空',
						type: 'default',
					})
				}
				if (!this.assistObj.surePassword) {
					return this.$refs.uToast.show({
						message: '确认密码不能为空',
						type: 'default',
					})
				}
				if (this.assistObj.password != this.assistObj.surePassword) {
					return this.$refs.uToast.show({
						message: '两次填写密码不相同',
						type: 'default',
					})
				}
			},
		}
	}
</script>

<style lang="scss" scoped>
	.c-content {
		min-height: 100vh;
		background-color: #fff;
		padding-bottom: 60rpx;
	}

	.add-recode {
		width: 100%;

		.add-type {
			padding: 0rpx 24rpx 8rpx 24rpx;

			.type-title {
				padding-top: 24rpx;
				padding-bottom: 0rpx;
			}
		}
	}

	/* 案件创建下一步按钮 */
	.add-btn {
		width: 100%;
		padding: 24rpx 12%;
		padding-bottom: 30rpx;
	}

	.add-btn /deep/ .u-button {
		font-size: 30rpx;
		height: 72rpx;
		line-height: 72rpx;
		box-shadow: 0px 0px 24px 0px rgba(28, 90, 210, 0.31);
		margin-top: 0rpx;
	}
</style>